<template>
  <div class="smart-con">
    <div class="fouse">
      <van-swipe class="my-swipe" :autoplay="8000" indicator-color="#f28533" :loop="false">
        <van-swipe-item v-for="item in fouseList" :key="item.id">
          <a href="#"><img :src="item.imgUrl" alt=""></a>
        </van-swipe-item>
      </van-swipe>
    </div>
    <div class="line"></div>
    <div class="nav">
      <div class="nav-item"><a href="3"> <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/e47dad0c224065a73a4c722eeaf1b8e1.jpg" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://i8.mifile.cn/v1/a1/eddc5967-7f37-bf45-72d9-de0db438658b.webp" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://i8.mifile.cn/v1/a1/8d73dc73-3a27-1587-6c43-47998c859a48.webp" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://i8.mifile.cn/v1/a1/3ad80cd6-0188-1c0a-95d3-aeaa58ede247.webp" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://i8.mifile.cn/v1/a1/afe66888-30af-d023-ebbe-6ed7e4607167.webp" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/a2bc35b6be2ab377bfc7e8fddeaa54c5.png" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/fed94691e4b361f237d411c3f687c2d4.png" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3304e52970aa972c4f4ccd6eb424ad7.png" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b9b8b8e686044afb2585e78a03ee96b6.png" alt=""></a></div>
      <div class="nav-item"><a href="3"> <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/d41a54c825db28e47888db6bd61349de.png" alt=""></a></div>
    </div>
    <div class="more">
      <img src="https://i8.mifile.cn/v1/a1/72411ddf-3df9-8d3a-7e5d-9429991710dc.webp" alt="">
      <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/c25c68694e064f1eda1c207ad481f767.jpg" alt="">
    </div>
    <div class="line"></div>
    <div class="product">
      <ul class="clearfix">
        <li class="product-item" v-for="(item,index) in product" :key="index ">
          <router-link :to="`/product/${item.id}`">
            <div class="img">
              <img v-lazy="item.imgUrl" alt="">
            </div>
            <div class="item-text">
              <h2 class="title">{{item.name}}</h2>
              <p>{{item.text}}</p>
              <p class="price">{{item.price}}元起</p>
              <router-link to="#" class="goBuy">立即购买</router-link>
            </div>
          </router-link>
        </li>

      </ul>
    </div>
    <div class="box">
      <div class="one">
        <img src="https://i8.mifile.cn/v1/a1/9a88bb58-8598-5b40-73cb-e18d47d7d073.webp" alt="">
        <ul class="clearfix">
          <li class="product-item" v-for="(item,index) in one" :key="index">
            <router-link :to="`/product/${item.id}`">
              <div class="img">
                <img v-lazy="item.imgUrl" alt="">
              </div>
              <div class="item-text">
                <h2 class="title">{{item.name}}</h2>
                <p>{{item.text}}</p>
                <p class="price">{{item.price}}元起</p>
                <router-link to="#" class="goBuy">立即购买</router-link>
              </div>
            </router-link>
          </li>
        </ul>
      </div>
      <div class="two">
        <ul class="clearfix">
          <li class="product-item" v-for="(item,index) in two" :key="index">
            <router-link :to="`/product/${item.id}`">
              <div class="img">
                <img v-lazy="item.imgUrl" alt="">
              </div>
              <div class="item-text">
                <h2 class="title">{{item.name}}</h2>
                <p>{{item.text}}</p>
                <p class="price">{{item.price}}元起</p>
                <router-link to="#" class="goBuy">立即购买</router-link>
              </div>
            </router-link>
          </li>

        </ul>
      </div>
      <div class="three">
        <img src="https://i8.mifile.cn/v1/a1/5f9c55a5-c60f-69c2-04ca-049aad5e26ba.webp" alt="">
        <ul class="clearfix">
          <li class="product-item" v-for="(item,index) in three" :key="index">
            <router-link :to="`/product/${item.id}`">
              <div class="img">
                <img v-lazy="item.imgUrl" alt="">
              </div>
              <div class="item-text">
                <h2 class="title">{{item.name}}</h2>
                <p>{{item.text}}</p>
                <p class="price">{{item.price}}元起</p>
                <router-link to="#" class="goBuy">立即购买</router-link>
              </div>
            </router-link>
          </li>

        </ul>
      </div>
      <div class="line"></div>
      <div class="end">
        <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/c6c71c1c81edf64e2c13c137c2820805.jpg?f=webp" alt="">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: 'Smart',
  data() {
    return {
      fouseList: [
        { id: 1, imgUrl: 'https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b23f24913cd96e2afdbb584655b4995a.jpg?thumb=1&w=720&h=360' },
        { id: 2, imgUrl: 'https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/37bd342303515c7a1a54681599e319a1.jpg?thumb=1&w=720&h=360' },
        { id: 3, imgUrl: 'https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/bb4a8b7d9e77567c7330776a866e717f.jpg?thumb=1&w=720&h=360' }
      ],
      product: [],
      one: [],
      two: [],
      three: []
    }
  },
  mounted() {
    this.getSmartList()
  },
  methods: {
    async getSmartList() {
      const res = await this.$API.homeSmartList()
      this.product = res.data.product
      this.one = res.data.one
      this.two = res.data.two
      this.three = res.data.three
    }
  }
}
</script>

<style lang="less" scoped>
.smart-con {
  padding: 84px 0 90px;
  .fouse {
    margin-top: 15px;
  }
  .my-swipe .van-swipe-item {
    color: black;
    img {
      width: 100%;
      height: auto;
    }
  }
  .nav {
    display: flex;
    flex-wrap: wrap;
    .nav-item {
      width: 150px;
      height: 152px;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .more {
    width: 720px;
    margin: 0 auto;
  }
  .product {
    width: 720px;
    margin: 0 auto;
    padding: 10px 0;
    text-align: center;
  }
  .box {
    width: 720px;
    margin: 0 auto;
    background-color: #eff1f3;
    img {
      width: 100%;
    }
    .product-item {
      border-radius: 15px;
    }
  }
  .product-item {
    float: left;
    width: 33.3%;
    margin-bottom: 6.6666px;
    padding: 15px;

    .item-text {
      text-align: center;
      font-size: 28px;
      line-height: 40px;
      p {
        color: #666;
      }
      .price {
        color: rgb(237, 60, 60);
      }
      .goBuy {
        display: inline-block;
        width: 200px;
        height: 59.6px;
        background-color: #ea625b;
        border-radius: 5px;
        color: #fff;
        line-height: 59.6px;
      }
    }
  }
  .end {
    width: 720px;
    margin: 0 auto;
  }
}
</style>
<style scoped>
/deep/ .van-swipe__indicator {
  width: 15px;
  height: 15px;
  margin: 0 10px;
}
</style>
